﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace Lib
{
    public class MailProcess
    {
        public static void SendMailHtml(string SendFrom,string sendName, string SendTo,string recName, string Subject, string Body,
            string host,int port,string user, string pass)
        {


            MailAddress sender = new MailAddress(SendFrom, sendName);
            MailAddress rec = new MailAddress(SendTo, recName);
            MailMessage mm = new MailMessage(sender, rec);
            mm.Subject = Subject;
            mm.Body = Body;
            mm.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = host;
            smtp.Port = port;
            smtp.Credentials = new NetworkCredential(user, pass);
            //smtp.Credentials=new 
            smtp.Send(mm);
        }
        //public static void SendMail(string SendFrom, string SendTo, string Subject, string Body,
        //    string host, int port, string user, string pass)
        //{
        //    //string toAddress = SendTo;
        //    MailMessage mm = new MailMessage(SendFrom, SendTo);
        //    mm.Subject = Subject;
        //    mm.Body = Body;
        //    mm.IsBodyHtml = false;
        //    SmtpClient smtp = new SmtpClient();
        //    smtp.Host = host;
        //    smtp.Port = port;

        //    smtp.Send(mm);
        //}
    }
}
